﻿@{
    Layout = "/Areas/Admin/Views/Shared/Manager.cshtml";
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>后台测试管理</title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />

    <script src="~/Content/js/jquery.easyui.min.js"></script>
</head>
@model Shumei.EFCore.Model.Course
<body>
    <div class="container">
        <form action="~/Admin/Courses/AddCourse" method="post">
            <div>
                <label for="course_name">课程略缩图</label>
                <div>
                    <a href="javascript:void()" onclick="uploadShowImg()" class="thumbnail" style="width:250px;height:140px;">
                        <img id="preview" src="..." alt="..." style="visibility:visible;width:100%;height:auto;">
                    </a>
                </div>
                <input name="CourseIcon" type="text" class="form-control" id="course_img" placeholder="none" style="visibility:hidden;">

            </div>
            <div class="form-group">
                <label for="course_name">课程名字</label>
                <input name="Name" type="text" class="form-control" id="course_name" placeholder="课程名">
            </div>
            <div class="form-group">
                <label for="news_name">课程类型</label>
                <input class="easyui-combobox " name="CourseTypeId" style="width:200px;"
                       data-options="valueField:'Id',textField:'Text',url:' @Url.Action("GetCourseType", "Courses")'" />
            </div>
            <div class="form-group">
                <label for="course_simpleDes">课程简述</label>
                <input name="CourseSimpleDes" type="text" class="form-control" id="course_simpleDes" placeholder="该课程还没任何简述">
            </div>
            <div class="form-group">
                <label>课程详细的描述</label>
                <script name="CourseDes" id="editor_container" type="text/plain" style="width:1024px;height:500px;">
                </script>
            </div>
            <button type="submit" class="btn btn-default">Submit</button>
        </form>
    </div>

    <script id="hied_editor" type="text/plain">
    </script>

    <script type="text/javascript" charset="utf-8" src="~/utf8-net/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/utf8-net/ueditor.all.min.js"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="/utf8-net/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript">
        var editor = UE.getEditor('editor_container');

        var otherEditor = UE.getEditor('hied_editor');
        otherEditor.ready(function () {
            otherEditor.hide();
            otherEditor.addListener('beforeinsertimage', function (t, arg) {

                //将地址赋值给相应的input,只去第一张图片的路径
                var imgs;
                for (var a in arg) {
                    imgs += arg[a].src + ',';
                }

                $("#course_img").attr("value", arg[0].src);
                //图片预览
                $("#preview").attr("src", arg[0].src);
            });
        });

        function uploadShowImg() {
            var myImage = otherEditor.getDialog('insertimage');
            myImage.open();
        }
    </script>

</body>
</html>
